<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/pc/jsp/common/common.jsp"%>
<%@ page language="java" import="com.limao.Model.PublicData"%>
<%@ page language="java" import="com.limao.DBDataClass.CrowdUserAuthClass"%>
 <%
 int sysTest=WebFunction.getSysTest();
 int userTest=1;
 int flagTest=1;
 if(sysTest==0)
 {
 	flagTest=0;
 }
 else
 {
	 String userid=(String)CacheClass.isLogin(request,response);
	 if(CacheClass.getIntValue(userid)!=0)
	 {
		 CrowdUserAuthClass user= WebFunction.getUserInfo(request,response);
		 userTest=CacheClass.getIntValue(user.userTest);
		 if(userTest==1)
		 {
		 	flagTest=1;
		 }
		 else
		 {
		 	flagTest=0;
		 }
	 } 
	 else
	 {
	 	flagTest=1;
	 }
 
 }
 

 
 %>
	<div class="theme-popover-mask"></div>
    <div id="loginIframeDiv" class="loginIframeDiv w100 h100 pf">
        <div class="loginIframe">
            <iframe class="w100 h100 of db" src="pc/login.jsp" frameborder="0" scrolling="no"  vsspace="0" hspace="0" marginwidth="0" marginheight="0" >

            </iframe>
        </div>
    </div>
    <!--loginIframeDiv-->
    <div id="registIframeDiv" class="loginIframeDiv w100 h100 pf">
        <div class="registIframe">
            <iframe class="w100 h100 of" src="pc/regist.jsp" frameborder="0" scrolling="no"  vsspace="0" hspace="0" marginwidth="0" marginheight="0">

            </iframe>
        </div>
    </div>
    <div id="forgotPwdIframeDiv" class="loginIframeDiv w100 h100 pf">
        <div class="registIframe">
            <iframe class="w100 h100 of" src="pc/forgotPassword.jsp" frameborder="0" scrolling="no"  vsspace="0" hspace="0" marginwidth="0" marginheight="0">

            </iframe>
        </div>
    </div>
    <div id="header" class="header pr">
        <div class="w100 pa" style="background:#f3f3f3;left: 0;border-bottom: 0;height: 1px;z-index: -1;bottom: 0;"></div>
        <div class="headerAd w100">
            <img src="pc/images/topad.jpg" class="db w100 h100">
        </div>
        <div class="w100 of">
            <div class="headernav jz clearfix of">
                <img src="pc/images/nav_logo.png" class="db fl">
                <ul class="fl">
                    <li id="headertab1" onclick="toLocation('pc/index.jsp');" >购物商城</li>
                    <li id="headertab5" onclick="toLocation('pc/faqizhongchou.jsp');">成为供应商</li>
                    <li id="headertab6" onclick="toLocation('pc/personalManagement.jsp');">邀请好友</li>
                </ul>
                
 <script>
    var flagTest='<%=flagTest%>';
    
	$(document).ready(function(){
		
		loginChanage();
		console.log(headertabcurrent);
	   $('#headertab1').removeClass('nav_tabcurrent');
	   $('#headertab2').removeClass('nav_tabcurrent');
	   $('#headertab3').removeClass('nav_tabcurrent');
	   $('#headertab4').removeClass('nav_tabcurrent');
	   $('#headertab5').removeClass('nav_tabcurrent');
	   $('#headertab6').removeClass('nav_tabcurrent');
	   switch(headertabcurrent)
	   {
	   case 1:
		   $('#headertab1').addClass('nav_tabcurrent');
		   break;
	   case 2:
		   $('#headertab2').addClass('nav_tabcurrent');
		   break;
	   case 3:
		   $('#headertab3').addClass('nav_tabcurrent');
		   break;
	   case 4:
		   $('#headertab4').addClass('nav_tabcurrent');
		   break;
	   case 5:
		   $('#headertab5').addClass('nav_tabcurrent');
		   break;
	   case 6:
		   $('#headertab6').addClass('nav_tabcurrent');
		   break;
	   }
	   
	   
	});
	
	function loginout()
	{
	
		$.ajax({
            url: "PlugServlet ",
            data: JSON.stringify({m:61,platform:0}),
            type: 'post',
            dataType: 'json',
            contentType:"application/json;charset=utf-8",
            success: function (data) {
            	console.log(data);
            	if(data['state']==1)
	          	{
	          		userid=null;
	          		layer.alert(data.info);
	          		loginChanage();
	          	}
	          	else
	          	{
	          		layer.alert(data.info);
	          	}
	         },
	         error: function (data) {
                 return false;
            },
         });	
	
	}
	
	function loginChanage()
	{
		  if(userid==null || userid=="" || userid==0)
		  {
		  		$('#headerLogin').show();
		  		$('#headerLogined').hide();
		  		$('#username').html('');
		  		$('#myAvatar').attr("src",'');
		  }
		  else
		  {
		  	  	$('#headerLogined').show();
		  		$('#headerLogin').hide();
		  		$('#username').html(username);
		  		$('#myAvatar').attr("src",imgBaseUrl+userobj.avatar);
		  }	
	
	}
	
	function loginOut()
	{
		  	  	$('#headerLogined').show();
		  		$('#headerLogin').hide();
		  		$('#username').html(username);
		  		$('#myAvatar').src(username);
		  		

	}
	
	
</script>
                <div id="headerLogin" class="headerLogin fr">
                    <div class="w100">
                        <div class="pr dib f15 fr rounded">
                            <div class="dib" id="loginBtn">登陆</div><div class="dib" id="registBtn">注册</div>
                            <span class="pa line"></span>
                        </div>
                        <img src="pc/images/headerMan.png" class="fr">
                    </div>
                </div>
               
                <div id="headerLogined" class="headerLogined fr">
                    <div class="w100 clearfix of">
                        <a title="个人管理" href="pc/personalManagement.jsp" class="fr db setting of"></a>
                        <a title="退出" onclick="loginout();" class="fr db exit of"></a>
                        <p class="name fr f16 c9" id="username"> </p>
                        <img id="myAvatar" src="pc/images/touxiang.jpg" class="fr touxiang of cursor" onclick="toLocation('pc/personalManagement.jsp');">
                    </div>
                </div>
                
            </div>
        </div>
    </div>
